﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_Flow_GetNotBangdingPosition]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_Flow_GetNotBangdingPosition];
GO
CREATE PROCEDURE [dbo].[sproc_Flow_GetNotBangdingPosition]
    @FlowID int,
    @StepID int
AS
SELECT position_id ,position_name 
    FROM 
        uds_position 
    WHERE     position_id not in 
                    (
                    SELECT b.position_id     
                    FROM     
                        uds_flow_member_bind a ,
                        uds_position b 
                    WHERE     a.obj_id = b.position_id 
                          and a.flow_id = @flowid
                        and a.step_id = @stepid
                          and a.obj_type =1
                          )